//
//  XMMessageTextTableCell.m
//  XMMessageKit
//
//  Created by lishi on 2019/3/5.
//  Copyright © 2019 lishi. All rights reserved.
//

#import "XMMessageTextTableCell.h"

//
#import "Masonry.h"

@interface XMMessageTextTableCell ()

// 聊天信息
@property (nonatomic, strong) UILabel *messageTextLabel;

@end

@implementation XMMessageTextTableCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
//        [self reloadDefultMeeageCell];
        [self reloadDefultMeeageKitCell];
    }
    return self;
}


- (void)setUpValueForCellMessageWithModel:(XMMessageModel *)model {
    self.messageNameLabel.text = model.messageName;
}

- (void)reloadDefultMeeageKitCell {
    [super reloadDefultMeeageKitCell];
    [self.contentView addSubview:self.messageTextLabel];
    [self.messageTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.messageNameLabel.mas_bottom).offset(10);
        make.left.mas_equalTo(self.messageHeadImageView.mas_right).offset(5);
        make.right.bottom.mas_equalTo(self.contentView).offset(-15);
    }];
}

//- (void)reloadDefultMeeageCell {
//    [super reloadDefultMeeageCell];
//    [self.contentView addSubview:self.messageTextLabel];
//    [self.messageTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(self.messageNameLabel.mas_bottom).offset(10);
//        make.left.mas_equalTo(self.messageHeadImageView.mas_right).offset(5);
//        make.right.bottom.mas_equalTo(self.contentView).offset(-15);
//    }];
//    self.messageNameLabel.text = @"小米";
//}

- (UILabel *)messageTextLabel {
    if (!_messageTextLabel) {
        _messageTextLabel = [[UILabel alloc] init];
        _messageTextLabel.text = @"一个优秀框架的最主要的特点是：简单。这种简单性不是轻而易举就可以获得的，正如优秀的框架不是一蹴而就的，达到这种简单性需要对框架不断地抽丝、";
        _messageTextLabel.backgroundColor = [UIColor blueColor];
        _messageTextLabel.numberOfLines = 0;
    }
    return _messageTextLabel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
